package cn.itsource.pet.service.impl;

import cn.itsource.basic.service.impl.BaseServiceImpl;
import cn.itsource.basic.util.TreeUtil;
import cn.itsource.pet.domain.PetType;
import cn.itsource.pet.mapper.PetTypeMapper;
import cn.itsource.pet.query.PetTypeQuery;
import cn.itsource.pet.service.IPetTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PetTypeServiceImpl extends BaseServiceImpl<PetType, PetTypeQuery> implements IPetTypeService {


    @Autowired
    private PetTypeMapper petTypeMapper;

    public List<PetType> tree(){

        //1.查询所有的petType
        List<PetType> petTypes = petTypeMapper.findAll();

        //2.使用工具类
        List<PetType> tree = TreeUtil.getTree(petTypes);

        return tree;
    }


}
